package face.pay.web.enterprise.controller.applyment;

import face.pay.common.enterprise.service.IMchChannelService;
import face.pay.entity.UserInfo;
import face.pay.security.annotation.CurrentUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
import java.util.Map;

/**
 * 进件首页
 */
@Controller
@RequestMapping("/applyment")
public class ApplyMentIndexController {

    @Autowired
    IMchChannelService iMchChannelService;


    @RequestMapping("/index")
    public  String index(@CurrentUser UserInfo loginUser, Integer mchUserId, Model model){

        mchUserId= mchUserId==null?loginUser.getId():mchUserId;

        Map<String,Boolean> channelMap = iMchChannelService.getUserChannels(mchUserId);

        model.addAttribute("mchUserId",mchUserId);

        model.addAttribute("channels",channelMap);
        /**
         * 判断当前用户 所支持的进件渠道
         */
        return "applyment/index";
    }
}
